package com.stox.services.indicator.model.intf;

import java.util.List;

import org.springframework.stereotype.Component;

import com.stox.shared.indicator.model.IndicatorBeanDescriptor;
import com.stox.shared.indicator.model.enumeration.IndicatorPosition;
import com.stox.shared.model.Bar;

@Component
public class SimpleMovingAverageRange extends
	SimpleMovingAverageVolume {
	
	private final IndicatorBeanDescriptor indicatorBeanDescriptor = new IndicatorBeanDescriptor(
			createDefaultConfiguration(),
			"SimpleMovingAverageRange",
			IndicatorPosition.INDEPENDENT,
			Double.class);
	
	@Override
	protected Double[] asDoubleArray(List<Bar> bars) {
		Double[] result = new Double[bars.size()];
		for(int index = 0; index < result.length; index++){
			result[index] = bars.get(index).getRange();
		}
		return result;
	}

	@Override
	public IndicatorBeanDescriptor getIndicatorBeanDescriptor() {
		return indicatorBeanDescriptor;
	}

}
